home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-08 | 4.4 KB | 158 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWTxtShp.h
- // Release Version: $ 1.0d11 $
- //
- // Copyright: © 1993, 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWTXTSHP_H
- #define FWTXTSHP_H
-
- #ifndef FWBTXTSH_H
- #include "FWBTxtSh.h"
- #endif
-
- #ifndef FWGCONST_H
- #include "FWGConst.h"
- #endif
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export on
- #endif
-
- //========================================================================================
- // class FW_CTextShape
- //========================================================================================
-
- class FW_CLASS_ATTR FW_CTextShape : public FW_CBaseTextShape
- {
- public:
- FW_DECLARE_CLASS
-
- //----------------------------------------------------------------------------------------
- // Constructors/Destructors
- //
- public:
-
- enum
- {
- kDefaultAlignment =
- FW_kTextAlignLeft |
- FW_kTextAlignTop |
- FW_kTextAlignUseSpecifiedPos
- };
-
- FW_CTextShape();
- FW_CTextShape(const FW_CString& string,
- FW_CFixed xPos,
- FW_CFixed yPos,
- const FW_PFont& font = FW_kNormalFont,
- FW_TextAlignment textAlignment = kDefaultAlignment,
- const FW_PInk& ink = FW_kNormalTextInk);
-
- FW_CTextShape(FW_CTextReader* textReader,
- FW_CFixed xPos,
- FW_CFixed yPos,
- const FW_PFont& font = FW_kNormalFont,
- FW_TextAlignment textAlignment = kDefaultAlignment,
- const FW_PInk& ink = FW_kNormalTextInk);
-
- FW_CTextShape(const FW_CTextShape& other);
- FW_CTextShape(FW_CReadableStream& archive);
-
- virtual ~ FW_CTextShape();
-
- //----------------------------------------------------------------------------------------
- // Operators
- //
- public:
- FW_CTextShape& operator=(const FW_CTextShape& other);
-
- //----------------------------------------------------------------------------------------
- // Inherited API
- //
- public:
- // ----- Rendering -----
- virtual void Render(FW_CGraphicContext& gc) const;
-
- // ----- Transform -----
- virtual void Transform(Environment* ev, ODTransform* odTransform);
- virtual void InverseTransform(Environment* ev, ODTransform* odTransform);
-
- virtual void MoveShape(FW_CFixed deltaX, FW_CFixed deltaY);
- virtual void MoveShapeTo(FW_CFixed x, FW_CFixed y);
-
- virtual void Inset(FW_CFixed x, FW_CFixed y);
-
- // ----- Copying -----
- virtual FW_CShape* Copy() const;
-
- // ----- Geometry -----
- virtual void GetBounds(FW_CGraphicContext& gc, FW_CRect& rect) const;
-
- // ----- Flatten -----
- virtual void Flatten(FW_CWritableStream& archive) const;
-
- //----------------------------------------------------------------------------------------
- // New API
- //
- public:
- // ----- Rendering -----
- static void RenderText(FW_CGraphicContext& gc,
- FW_CTextReader* textReader,
- const FW_CPoint& position,
- const FW_PFont& font,
- FW_TextAlignment textAlignment = kDefaultAlignment,
- const FW_PInk& ink = FW_kNormalTextInk);
-
- static void RenderText(FW_CGraphicContext& gc,
- const FW_CString& string,
- const FW_CPoint& position,
- const FW_PFont& font,
- FW_TextAlignment textAlignment = kDefaultAlignment,
- const FW_PInk& ink = FW_kNormalTextInk);
-
- // ----- Measurement -----
- FW_CPoint TextExtent(FW_CGraphicContext& gc) const;
-
- static FW_CPoint TextExtent(FW_CGraphicContext& gc,
- FW_CTextReader* textReader,
- const FW_PFont& font);
- static FW_CPoint TextExtent(FW_CGraphicContext& gc,
- const FW_CString& string,
- const FW_PFont& font);
-
- // ----- Archiving -----
- static void* Read(FW_CReadableStream& archive);
-
- // ----- Geometry -----
- FW_CPoint GetPosition() const
- {return fPosition;}
-
- void SetPosition(FW_CFixed xPos, FW_CFixed yPos)
- {fPosition.x = xPos, fPosition.y = yPos;}
-
- FW_TextAlignment GetTextAlignment() const
- {return fTextAlignment;}
- void SetTextAlignment(FW_TextAlignment textAlignment)
- {fTextAlignment = textAlignment;}
-
- void GetBaseLine(FW_CGraphicContext& gc,
- FW_CPoint& start, FW_CPoint& end) const;
-
- //----------------------------------------------------------------------------------------
- // Data Members
- //
- protected:
- FW_CPoint fPosition;
- FW_TextAlignment fTextAlignment;
- };
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export off
- #endif
-
- #endif
-